/**********************************************************************************************/
/* VKernel.h																	 			  */
/*                                                                       					  */
/* Copyright Paradigma, 1993-2006                                        					  */
/* All Rights Reserved.                                                 					  */
/**********************************************************************************************/

#ifndef _VLocal_h
	#define _VLocal_h
#pragma once

#include <VShared/FBL/publ/Headers/FBL.h>
#include <VShared/FBL/publ/Interfaces/FBL_I_Database.h>

// VSQL:
#include <VShared/VSQL/Headers/VSQL.h>
#include <VShared/VSQL/Interfaces/VSQL_I_SqlDatabase.h>


/**********************************************************************************************/
FBL_Begin_Namespace


/**********************************************************************************************/
// Must be called to init Valentina kernel: 
// it creates static members, load Valentina plugins and then create cache.
// If you specify the serial numbers as NULL, then kernel will work 10 minutes.
// Returns the actual size of cache it was able to allocate. 
// On the second potential call, it just returns the size of existed cache.
//
FBL_EXP ulong				ValentinaInit( 
								ulong 		inCacheSize = 9 * 1024 * 1024, 	// in bytes.
								char* 		inMacSN = NULL,					// your MacOS serial number.
								char* 		inWinSN = NULL,					// your Windows serial number.
								char*		inUnixSN = NULL );				// your Unix serial number.

// Must be called to finish work with Valentina lernel.
//
FBL_EXP void				ValentinaShutDown( void );


/**********************************************************************************************/
// This functions are needed to resolve ambiguity when linking to both 
// (client & local) DLLs at the same time. They are just wrappers to above ValentinaInit() 
// and ValentinaShutDown
//
// VClient.h have methods ValentinaInitC() and ValentinaShutDownC();
//
FBL_EXP ulong				ValentinaInitL(
								ulong inCacheSize,
								char* inMacSN = NULL,
								char* inWinSN = NULL );

FBL_EXP void				ValentinaShutDownL( void );


/**********************************************************************************************/
// Check serials

FBL_EXP bool				Valentina_CheckSerial(
								const char*  inKey );

FBL_EXP bool				Valentina_CheckSerial(
								const char*  inKey,
								std::string* outUserName,
								std::string* outPlatform, 
								ushort* outDay,
								ushort* outMonth,
								ushort* outYear );

FBL_EXP bool				Valentina_CheckSerial(
								const char*  inKey,
								FBL::String* outUserName,
								FBL::String* outPlatform, 
								ushort* outDay,
								ushort* outMonth,
								ushort* outYear );


/**********************************************************************************************/
// Factory of FBL::I_Database. 
//
FBL_EXP	FBL::I_Database_Ptr	CreateDatabase( 
								EStorageType 	inStorage = FBL::kStorage_Disk );


/**********************************************************************************************/
FBL_End_Namespace


#pragma mark -


/**********************************************************************************************/
VSQL_Begin_Namespace


// Factory of FBL::I_Database. 
//
FBL_EXP I_SqlDatabase_Ptr 	CreateSqlDatabase(	
								EStorageType 	inStorage = kStorage_Disk );


/**********************************************************************************************/
VSQL_End_Namespace


/**********************************************************************************************/
#endif // _VLocal_h


